package com.zzz.schedule.service.impl;

import com.zzz.schedule.dao.SysUserDao;
import com.zzz.schedule.dao.impl.SysUserDaoImpl;
import com.zzz.schedule.pojo.SysUser;
import com.zzz.schedule.service.SysUserService;
import com.zzz.schedule.util.MD5Util;

/*
 * @author zzr
 * @date: 2025/07/14  18:04
 * @description:
 */
public class SysUserServiceImpl implements SysUserService {
    private SysUserDao userDao = new SysUserDaoImpl();

    @Override
    public int regist(SysUser sysUser) {

        // 将用户输入的明文密码 转变为 密文密码
        sysUser.setUserPwd(MD5Util.encrypt(sysUser.getUserPwd()));
        // 调用 DAO 层的方法，将 sysUser 信息存入数据库~
        return userDao.addSysUser(sysUser);
    }

    @Override
    public SysUser finByUsername(String username) {
        return userDao.findByUsername(username);
    }

}
